<template>
  <div class="about">
    <h1>This is an about page</h1>
  </div>
</template>
<script>
import axios from 'axios'
export default {
  created() {
    this.getData()
  },
  methods: {
    async getData() {
      // const data = await axios.get('http://localhost:3000/blogs/get-test', {
      //   headers: {
      //     Authorization:
      //       'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwidXNlcm5hbWUiOiLmnLHlhYPnkosiLCJnZW5kZXIiOjEsImlhdCI6MTY1MzQ2NTQyMCwiZXhwIjoxNjUzNTUxODIwfQ.fYs1t9myLmcsWuLkBxcB4vYAt6tlozhqwstKOmhaGi0',
      //   },
      // })
      // console.log('data:', data)
      const data = await axios.post(
        'http://localhost:3000/blogs/list',
        {
          title: '文章内容-后端跨域cors',
          content: '文章',
          userId: 3,
        },
        {
          headers: {
            Authorization:
              'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwidXNlcm5hbWUiOiLmnLHlhYPnkosiLCJnZW5kZXIiOjEsImlhdCI6MTY1MzQ2NTQyMCwiZXhwIjoxNjUzNTUxODIwfQ.fYs1t9myLmcsWuLkBxcB4vYAt6tlozhqwstKOmhaGi0',
          },
        }
      )
      console.log('data:', data)
    },
  },
}
</script>
